//
//  SystemMessage.m
//  NewChat
//
//  Created by songKX on 16/3/15.
//  Copyright © 2016年 蓝鸥. All rights reserved.
//

#import "SystemMessage.h"

@implementation SystemMessage


-(void)setMessageTextWithType:(SystemMessageType)type{
    
//    SystemMessageTypeFriendAccept,//好友申请
//    SystemMessageTypeAgreeFriendAccept,//同意好友请求
//    SystemMessageTypeDisagreeAccept,//不同意好友请求
//    SystemMessageTypeDeleteFriend,//删除好友
//    SystemMessageTypeDeleteByFriend,//被好友删除
//    SystemMessageTypeDisagreeByFriend,//好友请求被拒绝
//    SystemMessageTypeAgressByFriend,//好友请求被同意

    
    
    
    switch (type) {
        case SystemMessageTypeFriendAccept:
        {
            
            self.message = [NSString stringWithFormat:@" %@ 想添加你为好友",self.accepter];
            
            break;
        }
        case SystemMessageTypeAgreeFriendAccept:
        {
            self.message = [NSString stringWithFormat:@"你同意了 %@ 的好友请求",self.accepter];
            break;
        }
        case SystemMessageTypeDisagreeAccept:
        {
            self.message = [NSString stringWithFormat:@"你拒绝了 %@ 的好友请求",self.accepter];
            break;
        }
        case SystemMessageTypeDeleteFriend:
        {
            self.message = [NSString stringWithFormat:@"你将 %@ 从好友列表中删除",self.accepter];
            break;
        }
        case SystemMessageTypeDeleteByFriend:
        {
            self.message = [NSString stringWithFormat:@"你被 %@ 从好友列表中删除",self.accepter];
            break;
        }
        case SystemMessageTypeDisagreeByFriend:
        {
            self.message = [NSString stringWithFormat:@"你的好友请求被 %@ 拒绝",self.accepter];
            break;
        }
        case SystemMessageTypeAgressByFriend:
        {
            self.message = [NSString stringWithFormat:@"%@ 通过了你的好友请求",self.accepter];
            break;
        }
        default:{
            break;
        }
    }

   
}

//设置消息时间

-(void)setAcceptTimeStamp{
    
    //获取当前北京时间
    NSDate *date = [NSDate date];
    
    NSTimeZone *zone = [NSTimeZone systemTimeZone];
    
    NSInteger interval = [zone secondsFromGMTForDate: date];
    
    NSDate *localeDate = [date  dateByAddingTimeInterval: interval];
    
    //设置时间显示格式并赋值
    NSDateFormatter *dateFormatter = [[NSDateFormatter alloc] init];
    [dateFormatter setDateFormat:@"MM/dd hh:mm"];
    NSString *dateString = [dateFormatter stringFromDate:localeDate];
    
    self.timeStamp = dateString;
    
}


@end
